﻿<?php
include_once("./function.php");
//print_r($_GET);die;//Array ( [sys_id] => 1 )
if(isset($_GET['sys_id']))
{
$sql="select * from ts_sysconfig where sys_id=".$_GET['sys_id'];
$res=mysqli_query($link,$sql);
if(is_object($res))
{
	if(mysqli_num_rows($res)==1)
	{
		
		$list=mysqli_fetch_assoc($res);
		
	}
	//print_r($list);die;//Array ( [sys_id] => 10 [sys_title] => 出师表 [sys_name] => wwwmmm2 [sys_val] => 李白 [sys_type] => on )
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改配置项</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
<style>.sp{display:inline-block;} .sp{width:60px;display:inline-block;padding:0px;border:0px;background:#fff;}</style>
</head>
<body leftmargin="8" topmargin='8'>
<form action="do_sys_conf_edit.php" method="get" id="form" onsubmit="return check();">
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' colspan="2"><span><img src='skin/images/frame/arr3.gif' style='margin-right:10px;'>修改配置项</span></td>
  </tr>
  
  <tr bgcolor="#FFFFFF">
    <td>
		<table style="margin-bottom:8px;margin-top:8px;margin-left:20px;">
			 <tr>
				<td width="100px;">配置项标题:</td>
				<td><input type="text" name="title" value="<?=isset($list)?$list['sys_title']:''?>"/></td>
				<td></td>
			  </tr>
			   <tr>
				 <td>配置项名称:</td>
				 <td><input type="text"  name="uname" value="<?=isset($list)?$list['sys_name']:''?>"/></td>
				 <td></td>
			   </tr>
			   <tr>
				<td>配置项内容:</td>
				<td id="wbk"><input type="text"  name="content" value="<?=isset($list)?$list['sys_val']:''?>"/><font color="red">*</font><span id="tip_a" class="sp"></span></td>
				<td></td>
			   </tr>
			   <tr>
				 <td>配置项类型:</td>
				 <td><input type="radio" name="text" value="text" onclick="test()" checked>文本框 <input type="radio" name="text" value="textarea"onclick="test1()"> 文本域
				 </td>
				 <td></td>
			   </tr>
			   <tr>
				 <td colspan="2" align="center" height="40px">
				<?php if(isset($list)){if(($list['sys_title']=="标题"&&$list['sys_name']=="title")||($list['sys_title']=="网页描述"&&$list['sys_name']=="description")||($list['sys_title']=="关键字"&&$list['sys_name']=="keyword")){?>
				   <input type="hidden"name="title"value="<?=$list['sys_title']?>">
				   <input type="hidden"name="uname"value="<?=$list['sys_name']?>">
				<?php } }?>
				    <input type="hidden" name="sid" value="<?=$_GET["sys_id"]?>"/>
					<input type="submit" name="sub" value=" 修改 " />
					<td></td>
				</td>
			   </tr>
		</table>
	</td>
  </tr>
  
</table>
</form>
<script type="text/javascript">
	wbk=document.getElementById("wbk");
	function test()
	{
		wbk.innerHTML="<input type='text' placeholder='如:欣才商城' name='content' value='<?=$list['sys_val']?>'/>";
	}
	function test1()
	{
		wbk.innerHTML="<textarea name='content' cols=15 rows=5><?=$list['sys_val']?></textarea>";
	}

	inp=document.getElementsByTagName("input");
	if(inp[0].value=="网页描述"||inp[0].value=="关键字"||inp[0].value=="标题")
	{
		inp[0].disabled="disabled";
	}
	if(inp[1].value=="description"||inp[1].value=="keywords"||inp[1].value=="title")
	{
		inp[1].disabled="disabled";
	}
	tip_a=document.getElementById("tip_a");
	form.content.onblur=function()
	{
		if(form.content.value=="")
		{
			tip_a.style.color="red";
			tip_a.innerHTML="不能为空";
		}
		else
		{
			tip_a.innerHTML="";
		}
	}
	function check()
	{
		if(form.content.value=="")
		{
			alert("修改内容不能为空");
			return false;
		}
		return true;
	}
</script>
</body>
</html>


